package com.myrabbitmqdemo.demo.utils;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Channel;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class RabbitMqUtils {

    public static Channel getChannel() throws IOException, TimeoutException {

        ConnectionFactory factory = new ConnectionFactory();

        factory.setHost("121.5.192.204");

        factory.setUsername("admin");

        factory.setPassword("123");

        Connection connection = factory.newConnection();

        return connection.createChannel();
    }
}
